package com.template.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.template.entity.Department;
import com.template.mapper.DepartmentMapper;
import com.template.service.DepartmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yumuyang
 * @since 2021-11-01
 */
@Service
public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Department> implements DepartmentService {

    @Autowired
    DepartmentMapper departmentMapper;

    public Page<Department> selectAllPage(Integer pn) {
        Page<Department> page = new Page<>(pn,10);
        return departmentMapper.selectPage(page,null);
    }

    public void saveDepartment(Department department) {
        departmentMapper.insert(department);
    }

    public void deleteDepartmentById(Integer id) {
        departmentMapper.deleteById(id);
    }

    public void updateDepartment(Department department) {
        departmentMapper.updateById(department);
    }

}
